<template>
    <div class="wh-100 p-8 ">
        <div class="wh-100 " style="background-color: white">
            <div class="w-100   d-flex-between-center pl-16 pr-16 bor-base-b ch50">
                <div class="fs-14 fw-6">档案登记历史</div>
                <Button @click="$router.go(-1)" style="background-color: white">返回</Button>
            </div>
            <div v-ref-height="refHeight" class="w-100 h-95">
                <Table :height="refHeight.value" :columns="columnsTwo" :data="dataTwo">
                    <template slot-scope="{ row, index }" slot="result">
                        <div class="wh-100">
                            <span v-if="row.result == 0" >学校驳回</span>
                            <span v-if="row.result == 1" >学校通过</span>
                            <span v-if="row.result == 2" >学院驳回</span>
                            <span v-if="row.result == 3" >学院通过，学校通过</span>
                            <span v-if="row.result == 4" >学院通过，学校驳回</span>
                            <span v-if="row.result == 5" >学生撤回</span>
                            <span v-if="row.result == 6" >学院通过，学校待审核</span>
                        </div>
                    </template>
                </Table>
            </div>
        </div>
    </div>
</template>
<script>
import { getListRecordData } from '../../api/archivesManagement/archiveForwardingAddressApis';
import { getDictDataByType } from '../../api';

export default {
    data(){
        return {
            refHeight:{value:0},
            columnsTwo: [],
            columnsTwo_1: [
                {
                    title: '序号',
                    type: 'index',
                    width: 65,
                    align: 'center'
                },
                {
                    title: '档案转递类型',
                    ket: 'transferType',
                    align: 'center',
                    render: (h, params) => {
                        return h('span', this.accountTypeList.filter((item) => item.value == params.row.transferType)  ? this.accountTypeList.filter((item) => item.value == params.row.transferType)[0].title : '');
                    }
                },
                {
                    title: '档案转递单位名称',
                    key: 'unitName',
                    align: 'center',
                },
                {
                    title: '档案转递地址',
                    key: 'unitAddress',
                    align: 'center',
                },

                {
                    title: '填报时间',
                    key: 'createTime',
                    align: 'center',
                },
                // {
                //     title: '操作人',
                //     key: 'opr',
                //     align: 'center',
                // },
                {
                    title: '操作结果',
                    slot: 'result',
                    align: 'center',
                },
                {
                    title: '审核通过时间',
                    key: 'auditTime',
                    align: 'center',
                },

            ],
            dataTwo: [],
            accountTypeList: [],
            userId: this.$route.query.userId
        }
    },
    beforeDestroy() {
        window.removeEventListener('resize',this.onRestWindow)
    },
    methods: {
        onRestWindow() {
            this.columnsTwo = this.restTableCellWidth(this.columnsTwo_1)
            // this.labelWidth = this.searchLabelWidth(this.labelWidth)
        },
        async obtainTheAccountMigrationType() {
            let res = await getDictDataByType('file-forwarding-type')
            if (res.code === 200) {
                this.accountTypeList = res.result
            }
        },
        getRecordList() {
            getListRecordData({userId: this.userId}).then(res => {
                this.dataTwo = res.result;
                console.log("aaaaaaaaaaaaaaa",this.dataTwo)
            })
        }
    },
    async mounted() {
        this.onRestWindow()
        window.addEventListener('resize',this.onRestWindow)
        await this.obtainTheAccountMigrationType()
        this.getRecordList()
    }
}
</script>
<style scoped lang="less">
//form表单间距统一修改
.ivu-form-item {
    margin-bottom: 0.01rem !important;
}
.ch50 {
    height: 50px
}
</style>